#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/wait.h>
//创建一个子进程，父进程调用pause函数， 子进程给父进程发送信号
int main(int argc, char const *argv[])
{
    /* code */
    pid_t pid = fork();
    if (pid == 0) {
        printf("child process pid : %d \n", getpid());
        sleep(2);
        kill(getppid(), SIGUSR1);
        exit(EXIT_SUCCESS);

    } else if (pid > 0) {
        sleep(1);
        printf("parent process pid : %d \n", getpid());
        pause(); // 需要在收到信号之前调用， 让进程处于睡眠状态
        printf("parent process receive signal \n");
    }
    return 0;
}
